﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
using System.Text;
using ReflectionStudio.Core.Events;
using INTEX.DataBase.Tools;
using INTEX.DataBase;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{

    public class JLTVR04DOCData : BaseFunction
    {

        SETINTEXDB INTEXDB = new SETINTEXDB();
        public ApplicationBase app
        {
            get
            {
                return ApplicationBase.Instance;
            }
        }
        public INTEXDBC INTEXDBC
        {
            get
            {
                return app.INTEXDBC;
            }
        }
        public INTEXBL INTEXBL
        {
            get
            {
                return app.INTEXBL;
            }
        }
        public JLTVR04DOCData()
            : base()
        {
            Helper.GetDate(ref date, ref year, ref month, ref day);
        }  

        public DataSet GetData(DataRow dwInput)
        {
            DataSet SReturn = new DataSet();
            DataSet SResult = new DataSet();
            DataSet STemp = new DataSet();
            DataRow dwTemp;
            DataRow dwVK04 = null;
            try
            {
                string MANDANT = dwInput["VKKMANDANT"].ToString();
                string KRS = dwInput["VKKAUFKRS"].ToString();
                string LFD = dwInput["VKKAUFLFD"].ToString();
                SResult = INTEXBL.QueryVKK(MANDANT, KRS, LFD);
                SReturn.Merge(SResult); 
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return SReturn;
        }
        public DataSet BuildData(DataRow dwInput)
        {
            DataSet SReturn = new DataSet();
            DataSet SResult = new DataSet();
            DataSet STemp = new DataSet();
            DataRow dwTemp;
            try
            {
                dwTemp = INTEXDB.VRPOS.NewRow();
                dwTemp["VRPMANDANT"] = dwInput["VRPMANDANT"];
                dwTemp["VRPAUFKRS"] = dwInput["VRPAUFKRS"];
                dwTemp["VRPAUFLFD"] = dwInput["VRPAUFLFD"];
                SResult = INTEXDBC.QueryVRKOPF(dwTemp, 2);
                SReturn.Merge(SResult);
            }
            catch (Exception ex)
            {
                Tracer.Error(ex.StackTrace, ex);
            }
            return SReturn;
        }
    }
}